﻿#include "SEAAutoWapper.h"
#include "FITK_Kernel/FITKAppFramework/FITKMessage.h"
#include "FITK_Kernel/FITKCore/FITKOperatorRepo.h"
#include "FITK_Kernel/FITKCore/FITKActionOperator.h"
#include "FITK_Kernel/FITKCore/FITKThreadPool.h"

#include <QString>

SEAAuto* SEAAutoWapper::new_SEAAuto()
{
    return new SEAAuto;
}

void SEAAutoWapper::delete_SEAAuto(SEAAuto * aut)
{
    if (aut) delete aut;
}

void SEAAutoWapper::static_SEAAuto_AutoCreateShell()
{
    QString objName = "actionAutoGenerateShell";
    Core::FITKActionOperator* actOper = Core::FITKOperatorRepo::getInstance()->getOperatorT<Core::FITKActionOperator>(objName);
    if (!actOper) return;
    actOper->actionTriggered();

    this->initSleep();
}

void SEAAutoWapper::static_SEAAuto_AutoCreateCavity()
{
    //AppFrame::FITKMessageError("preparation!");// 预备

    QString objName = "actionAutoGenerateCavity";
    Core::FITKActionOperator* actOper = Core::FITKOperatorRepo::getInstance()->getOperatorT<Core::FITKActionOperator>(objName);
    if (!actOper) return;

    //AppFrame::FITKMessageError(".......ing");//自动生成进行中

    actOper->actionTriggered();

    this->initSleep();

    //AppFrame::FITKMessageError("success");//完成
}

void SEAAutoWapper::initSleep()
{  
    //_sleep(100);
    //获取线程池
    Core::FITKThreadPool* pool = Core::FITKThreadPool::getInstance();
    if (pool == nullptr)return;
    //等待线程结束
    pool->wait();
}


